package cn.faurecia.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import cn.faurecia.dto.StockVo;
import cn.faurecia.whstock.service.impl.WhStockServiceImpl;

@Controller
@RequestMapping("/stockboard")
public class StockBoardController{
  @Autowired
  private WhStockServiceImpl stockService;
  
  @RequestMapping("/toStockBoard")
  public ModelAndView toOutStock(HttpServletResponse response, HttpServletRequest request, HttpSession session) {
    ModelAndView mav = new ModelAndView();
//    List<StockVo> dataList = stockService.queryFullData();
//    mav.addObject("dataList", dataList);
    mav.setViewName("/stockBoard");
    return mav;
  }
  @RequestMapping("/getStock")
  @ResponseBody
  public List<StockVo> getStock(HttpServletResponse response, HttpServletRequest request, HttpSession session) {
    List<StockVo> dataList = stockService.queryFullData();
//    session.setAttribute("dataList", dataList);
    return dataList;
  }
  
  @RequestMapping("/toLevelingBoard")
  public ModelAndView toLevelingBoard(HttpServletResponse response, HttpServletRequest request, HttpSession session) {
	  ModelAndView mav = new ModelAndView();
//    List<StockVo> dataList = stockService.queryFullData();
//    mav.addObject("dataList", dataList);
	  mav.setViewName("/levelingBoard");
	  return mav;
  }
}
